# import pandas as pd
# data2 = pd.DataFrame(data=[['lisa', 'f', 22], ['joy', 'f', 22], ['tom', 'm', '21']],\
#                      index=[1, 2, 3],columns=['name', 'sex', 'age'])
# '''
#    name sex age
# 1  lisa   f  22
# 2   joy   f  22
# 3   tom   m  21
# '''
# #按照列的名字查询列
# data2["name"]
# # 1    lisa
# # 2     joy
# # 3     tom
# # Name: name, dtype: object
#
# #按照行索引进行查询
# data2[1:3] #输出2-3行
# #   name sex age
# # 2  joy   f  22
# # 3  tom   m  21
#
# #返回列
# data2.columns
# # Index(['name', 'sex', 'age'], dtype='object')
#
# #转为list
# list(data2.columns)
# '''['name', 'sex', 'age']'''
# list(data2.columns)[0:2]
# '''['name', 'sex']'''
#
# #查询一列数据
# #data2[data2.columns[-1]]              data2[data2.columns[-2]]              data2[data2.columns[-3]]
# '''
# 1    22                                1    f                                1    lisa
# 2    22                                2    f                                2    joy
# 3    21                                3    m                                3    tom
# Name: age, dtype: object               Name: sex, dtype: object              Name: name, dtype: object
# '''
# #将一列转换为列表
# print(list(data2[data2.columns[-1]]))
# [22, 22, '21']
#
# #查询多列
# data2[data2.columns[0: 2]]
# '''
#    name sex
# 1  lisa   f
# 2   joy   f
# 3   tom   m
# '''
# list(data2[data2.columns[0: 2]])
# #['name', 'sex']  可见多行数据无法转换成列表
#
#
# #查询一个数据，使用loc，选取一个数据
# data2.loc[1, "name"]
# 'lisa'
# #查询多个数据，使用loc[rowIndex, column_name]  选取多个数据， 指定范围的行，1: 3都会选取,且只要name 和age列
# data2.loc[1: 3, ["name", "age"]]
# '''
#    name age
# 1  lisa  22
# 2   joy  22
# 3   tom  21
# '''
# data2.loc[[1, 3], ["name", "age"]]
# '''
#    name age
# 1  lisa  22
# 3   tom  21
# '''
#
# #使用下标选取数据iloc[rowIndex, column_index], 下标从0 开始
# data2.iloc[1, 0]
# 'joy'
# print(data2.iloc[2, 1])
# 'm'
# #选取多个,多行选取
# data2.iloc[0:2, 0]
# '''
# 1    lisa
# 2     joy
# Name: name, dtype: object
# '''
#
import pandas as pd
lst =[list("lk1253"),list("df6548")]
df = pd.DataFrame(lst, columns=list("abcdef")) #abcdef表示6列对应的索引
#列表转换成df
df[["c","d","f"]]=df[["c","d","f"]].astype('int32')
lst=df.apply(lambda x: x.to_list(),axis=1)
#df转换成列表
print([*lst])
#

divide_by_three = lambda x : True if x % 3 == 0 else False
selected_numbers = []
for number in range(1, 11):
    if divide_by_three(number):
        selected_numbers.append(number)
print(selected_numbers)

# L4_7 =  [ [4, 7], [5, 3], [6, 3]                         ]
# for i in range(1, len(Ln_m) - 1):
#     for j in range(i + 1, len(Ln_m)):
#         k += 1
#         m.addConstr(C[Ln_m[i][0], Ln_m[0][0]] + Ln_m[i][1] <= C[Ln_m[j][0], Ln_m[0][0]] + Z[k] * M, '')
#         m.addConstr(C[Ln_m[j][0], Ln_m[0][0]] + Ln_m[j][1] <= C[Ln_m[i][0], Ln_m[0][0]] + (1 - Z[k]) * M, '')